This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host Web Hosting Help

Import a MySQL Database using phpMyAdmin

How to Import a MySQL Database using phpMyAdmin

This article discusses importing your mySQL database. If you were looking to export your database instead, you will want to follow the guide in MySQL Import and Export instead.

How can I import a database?

  1. Log in to your Just Host cPanel account.
  2. Navigate to the Database Tools section, and select phpMyAdmin.
  3. Log in with your cPanel username and your MySQL password
    Note: The Master MySQL Password can be set from the "Reset MySQL Password" tool in the same "Databases" category.
  4. In phpMyAdmin you will see a list of your databases on the left side. Select the database you would like to import to.
  5. Once the database is selected, click the "Import" tab at the top.
  6. In this sub-section, a "browse" button will appear. Select this, and choose the desired .sql file on your PC.
  7. After you have selected the file, click "Go" at the bottom right; it will import your .sql file for you.
Note: The maximum size for a sql upload via phpMyAdmin is 50MB. For larger databases please either split the database before importing, or import via SSH, as described here.

Common Issues

Your import file is too large!

You will know this is the case when phpMyAdmin times out. (It will timeout after 30 seconds of attempting to import.)

If you experience this timeout, you will need to use an alternate method to import the database. See https://my.Justhost.com/hosting/help/162

For security reasons, it's best to upload your database to the /home/USERNAME section of your account. (Replace USERNAME with your cPanel username.)

#1044 - Access denied for user 'username1'@'localhost' to database 'user2_wrdp9'

The problem here is your import file contains an SQL query that attempts to create a database for the wrong username. Notice the user2 in 'user2_wrdp9' does not match the username1 in 'username1'@'localhost'. Someone must edit the import file and change the old user2 to your new username1. Here is an example of what it looks like (notice 3 places where the username is outdated):

Database: `user2_wrdp9`CREATE DATABASE `user2_wrdp9` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;USE `user2_wrdp9`;
#1044 - Access denied for user 'username1'@'localhost' to database 'wrdp9'

Same as the previous issue; the correct username is missing. On a shared sever, your database names must always look like exampleuser_exampledatabase.

#1049 - Unknown database 'username1_wrdp9'

The problem is your import file does not have a query to create the database before importing the data. Simply go to cPanel > MySQL Databases and create a database with that name (in my example, "wrdp9"). Then re-attempt your import.

#1007 - Can't create database 'username1_wrdp9'; database exists

The problem here is your import file contains an SQL query that attempts to create a database that already exists. If the database is empty, simply go to cPanel > MySQL Databases and remove that empty database; then re-attempt your import. If the database is not empty, someone must edit the import file and remove the CREATE DATABASE query. Here is an example of what it looks like:

CREATE DATABASE `username1_wrdp9` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near...

The file does not contain backup data for a database, or the file has been changed or corrupted.

Less Common Issues

ERROR 1044 (42000): Access denied for user 'username1'@'localhost' to database 'username1_wrdp9'

If you get this error, you do not have privileges on user_* to use Create. Just Host will need to correct this issue for you.

However, if you need to import now, and can't wait, here is a work-around.

The problem here is your import file contains at least one SQL query that attempts to create a database, and you do not have the privilege to do so. Someone must edit the import file and remove the CREATE DATABASE query. Here is an example of what it looks like:

CREATE DATABASE `username1_wrdp9` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;

After you remove this code, you must go to cPanel and click the MySQL Databases icon. Here you must create your database with the name which was removed from the import file (in my example, "wrdp9"). Then you can Import the modified import file and it will work.

Knowledgebase Article 781,225 views bookmark tags: database mysql phpmyadmin


Was this resource helpful?

Did this resolve your issue?


Please add any other comments or suggestions about this content:





Recommended Help Content

How do I create a MySQL backup?
Knowledgebase Article 418,413 views tags: backup database mysql

A repository of information on how you can manage your database by using the phpMyAdmin interface.
Knowledgebase Article 375,142 views tags: commands database mysql phpmyadmin

A guide on performing a standard SQL query using the phpMyAdmin interface
Knowledgebase Article 191,222 views tags: databases mysql phpmyadmin

Related Help Content

I need to Export or Import a MySQL database
Knowledgebase Article 418,174 views tags: mysql phpmyadmin ssh

How to Restore your MySQL Database?
Knowledgebase Article 383,495 views tags: admin database mysql php phpmyadmin restore

How to export your database in phpMyAdmin..
Knowledgebase Article 258,288 views tags: database export myphpadmin

A tutorial on how to perminately delete columns from your mySQL database using phpMyAdmin
Knowledgebase Article 188,193 views tags: Plesk cpanel databases mysql phpmyadmin

A guide to duplicating a MySQL database using phpMyAdmin
Knowledgebase Article 242,322 views tags: databases mysql phpmyadmin

This article will walk you through the steps to copying and renaming a database with phpMyAdmin.
Knowledgebase Article 161,201 views tags: database phpmyadmin

How to backup all of your MySQL databases using the Site Backup & Restore tool
Knowledgebase Article 270,934 views tags: backup database mysql restore site

This article will show you how to rename a database table in phpMyAdmin.
Knowledgebase Article 322,097 views tags: databases mysql phpmyadmin

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.